[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
_graphfreemem() Deallocate Graphics Memory
#include <graphics.h>
void far _graphfreemem(ptr,size);
void far *ptr;
unsigned size;
_graphfreemem() deallocates memory previously allocated with
_graphgetmem(). By defining your own version of _graphfreemem() you
can override the default function with the same name in the C++
library. _graphfreemem() must be declared exactly the same as shown
above.
Returns: Nothing.
-------------------------------- Example ---------------------------------
The following statements define a new _graphfreemem() function which
closegraph() uses to deallocate memory.
#include <graphics.h>
#include <alloc.h>
#include <stdio.h>
int far *gblock;
main()
{
int gdriver = DETECT;
int gmode;
initgraph(&gdriver,&gmode,"");
.
.
/* graphics operations */
.
.
closegraph();
}
void far *far _graphgetmem(size)
unsigned size;
{
if ((gblock = farmalloc(size)) != NULL)
printf("_graphgetmem allocated %u memory\n",size);
else
printf("unable to allocate memory\n");
getch();
return(gblock);
}
void far _graphfreemem(ptr,size)
void far *ptr;
unsigned size;
{
printf("_graphfreemem called, amount freed = %d\n",size);
getch();
farfree(ptr);
}
See Also:
_graphgetmem()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson